/**
 * Created with IntelliJ IDEA.
 * Description: 五个人轮流给其他人分糖果，
 * 每次分完之后其他人的糖果数量都翻倍，最后每个人都是32个糖果
 * 求最初每个人多少糖果
 */
public class Test2 {
    public static void main(String[] args) {
        int[] nums = {32,32,32,32,32};
        for (int i = 4; i >= 0; i--) {
            int sum = 0;
            for (int j = 0; j < 5; j++) {
                if(i != j) {
                    nums[j] = nums[j] / 2;
                    sum += nums[j];
                }
            }
            nums[i] += sum;
        }
        for (int i = 0; i < 5; i++) {
            System.out.println("第" + (i + 1) + "位朋友的糖果数：" + nums[i]);
        }
    }
}
